gnu.cfg: Add __builtin_ctz - #8721
Open
kronus-ed wants to merge 1 commit into
Open
Conversation
__builtin_ctzl, and __builtin_ctzll trailing zero count functions.
Collaborator
|
Thanks for your contribution. Can those functions be |
Contributor
|
I don't see __builtin_ctz at that link. I instead found it here: https://gcc.gnu.org/onlinedocs/gcc/Bit-Operation-Builtins.html, which has several other similar functions that could be added as well. I also found a file in gcc that gives the ctz builtin ATTR_CONST_NOTHROW_LEAF_LIST so it is pure/const as expected of a bit fiddling function. I will look into making a more general PR for all these builtins. |
chrchr-github
pushed a commit
that referenced
this pull request
Sep 10, 2026
I implemented all of the functions described at [https://gcc.gnu.org/onlinedocs/gcc/Built-in-Functions.html](https://gcc.gnu.org/onlinedocs/gcc/Built-in-Functions.html) except for the ones that have a variable return type based on the arguments. This PR should be a superset of the changes proposed in #8721. I didn't write any tests because I am not sure what the standard practice is. Should I try to have a test for each <function> tag? I have some tests, but I figured I would ask first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference: https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html